package com.gitee.wsl.compose.chart.xy.line.stairstep

import androidx.compose.animation.core.AnimationSpec
import androidx.compose.runtime.Composable
import com.gitee.wsl.common.ui.draw.style.AreaStyle
import com.gitee.wsl.common.ui.draw.style.LineStyle
import com.gitee.wsl.compose.chart.KoalaPlotTheme
import com.gitee.wsl.compose.chart.SelectCheck
import com.gitee.wsl.compose.chart.xy.SymbolSlate
import com.gitee.wsl.compose.chart.xy.line.LinePlot
import com.gitee.wsl.compose.chart.xy.line.LinePlotSlate
import com.gitee.wsl.compose.chart.xy.line.area.model.AreaBaseline
import com.gitee.wsl.compose.chart.xy.model.PointEntry

fun <X, Y> LinePlot.Stairstep( lineStyle: (Int) -> LineStyle,
                               symbol: SymbolSlate<PointEntry<X, Y>>? = null,
                               areaStyle: (Int) -> AreaStyle? = { null },
                               areaBaseline: (Int) -> AreaBaseline<X, Y>? = { null },
                               animationSpec: @Composable (Int) -> AnimationSpec<Float> = { KoalaPlotTheme.animationSpec },
                               selected:SelectCheck = { false }
) :LinePlotSlate<X, Y> = { index, data->
    StairstepPlot(
        data = data,
        lineStyle = lineStyle(index),
        symbol = symbol,
        areaBaseline = areaBaseline(index),
        areaStyle = areaStyle(index),
        animationSpec = animationSpec(index),
        selected = selected(index)
    )
}